import java.util.Scanner;

public class Test {
    public static void main(String[] args) {
        int[] arr = {1,5,6,9,1,7,1};
        int count = 0;
        int n = arr.length/2;

    }
    public static void main5(String[] args) {
        hanoiTower(3,'A','B','C');

    }
    public static void hanoiTower(int num, char a, char b, char c) {
        if(num == 1) {
            System.out.println("第" + num + "个盘" + "从" + a + "移动到" + c);
        }else {
            hanoiTower(num - 1, a, c ,b);
            System.out.println("第" + num + "个盘" + "从" + a + "移动到" + c);
            hanoiTower(num - 1, b, a, c);
        }

    }
//public class Test {
//    //求斐波那契数列第n项
//    public static int feiB(int n) {
//        if((n == 2) || (n == 1)) {
//            return 1;
//        } else {
//            return feiB(n-1) + feiB(n-2);
//        }
//    }
//    public static void main4(String[] args) {
//        System.out.println(feiB(6));
//    }
//    //冒泡排序
//    public static void main3(String[] args) {
//        int[] arr = {1,3,4,2,5,7,8,6,10,9};
//        for (int i = 0; i < arr.length-1; i++) {
//            for (int j = 0; j < arr.length-1-i; j++) {
//                if (arr[j] < arr[j+1]) {
//                    int tmp = 0;
//                    tmp = arr[j];
//                    arr[j] = arr[j+1];
//                    arr[j+1] = tmp;
//                }
//            }
//        }
//        for (int i = 0; i < arr.length; i++) {
//            System.out.print(arr[i]+" ");
//        }
//    }
    //二分查找
    public static void main2(String[] args) {
        Scanner sc = new Scanner(System.in);
        System.out.print("请输入一个整数:");
        int key = sc.nextInt();
        int[]arr = {1,2,3,4,5,6};
        int left = 0;
        int right = arr.length-1;
        int mid = 0;
        int flag = 1;
        while(left<=right) {
            mid=(left+right)/2;
            if (arr[mid]<key) {
                left = mid + 1;
            }
            if(arr[mid] > key) {
                right = mid-1;
            }
            if(arr[mid] == key) {
                System.out.println("找到了,下标为"+mid);
                flag = 0;
                break;
            }
        }
        if(flag == 1) {
            System.out.println("没有此数");
        }
    }
    public static int[] transForm (int[] arr) {
        for (int i = 0; i < arr.length; i++) {
            arr[i] = arr[i]*2;
        }
        return arr;
    }
    public static void main1(String[] args) {
        int[] arr = {1,2,3};
        transForm(arr);
        for (int i = 0; i < arr.length;i++) {
            System.out.print(arr[i]+" ");
        }
    }
}
